package com.example.demo;

import com.example.demo.entity.Person;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class Controller {
    @RequestMapping("/age")
    public Integer age(Integer age) {
        if (age == null) {
            return 0;
        }
        return age;
    }

    @RequestMapping("/person")
    public String person(@RequestParam(value = "aa",required = false) String name, Integer age) {
        return "姓名为："+name+"年龄为："+age;
    }
    @RequestMapping("/Person")
    public Person getPerson(Person person) {
        return person;
    }
}
